<!--初始页-->
<!doctype html>
<html>
<head>
	<meta charset="UTF-8">
	<title></title>
	<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<link href="css/mui.min.css" rel="stylesheet" />
	<link href="css/animate.css" rel="stylesheet"  >
</head>
<style type="text/css">
	
	
	.item-logo {
		width: 100%;
		height: 100%;
		position: relative;
	}
	.item-logo a {
		width: 200px;
		height: 200px;
		display: block;
		border: 1px solid #FFFFFF;
		border-color: rgba(255, 255, 255, 0.5);
		text-align: center;
		line-height: 200px;
		border-radius: 50%;
		font-size: 40px;
		color: #fff;
		position: absolute;
		top: 15%;
		left: 50%;
		margin-left: -100px;
	}
	.lable {
		position: absolute;
		left: 0;
		bottom: 15%;
		width: 100%;
		color: #fff;
		font-size: 16px;
		text-align: center;
	}
	
</style>
<body>
	<div id="App">
		<div id="bg" class="mui-fullscreen" style="background-color: black;">
			<div class="item-logo" style="background-color: #1D5494">
				<a href="#" class="animated bounceIn delay-3s">
					电力运维
				</a>
				<div class="lable animated rubberBand  delay-3s">
					引领时代！节能、安全、享受
				</div>
			</div>
		</div>
	</div>
</body>
<script src="js/mui.min.js"></script>
<script src="js/jquery-3.2.1.min.js"></script>
<script src="js/jquery.md5.js"></script>
<script src="js/common.js"></script>
<script src="js/nv-bar.js"></script>
<script type="text/javascript">
	
	mui.init();
	//消耗掉退出.
	mui.back = function back(){};
	mui.plusReady(function(){
		plus.navigator.setStatusBarStyle('light');
		plus.navigator.setStatusBarBackground('#1D5494');
		
		if("true" == localStorage.getItem(constValue.autoLogin) ){
			var userName = localStorage.getItem(constValue.userName);
			var passWord = localStorage.getItem(constValue.passWord);	
			Login(userName,passWord);
		}else{
			gotoLogin();
		}
	
		function Login(userName,passWord){
			
			services.login(userName,$.md5(passWord)).then((data)=>{
				//console.log(JSON.stringify(data))
				if(data.flag == true || data.flag =="true"){
					//存储密码到本地
					localStorage.setItem(constValue.autoLogin,"true");
					localStorage.setItem(constValue.userName,userName);
					localStorage.setItem(constValue.passWord,passWord);
					localStorage.setItem(constValue.token, data.token);
	
					var obj = JSON.stringify(data.accountDetail)//如果要把一个对象存到缓存里面的话  要把这个对象用JSON.stringify()转一下再缓存;
					localStorage.setItem(constValue.accountDetail, obj);				
					var options = {
						styles:{
							subNViews:__nvbar__.subNViews
						},
						waiting:{
								autoShow:false,//自动显示等待框，默认为true
						},
						extras:{}
					};
	
					setTimeout(function(){
						mui.openWindow("index-native.html","index-native",options);
					},1000)
									
				}else { 
					localStorage.setItem(constValue.autoLogin,"false");
					mui.toast("请检查网络状态，用户名和密码是否错误！");
					gotoLogin();
				}
			}).catch((erro)=>{
				console.log(JSON.stringify(erro))
				mui.toast("请检查网络状态，用户名和密码是否错误！");
				gotoLogin();
			});
			
		}
		
			
		function gotoLogin(){
			setTimeout(function(){
				var options = {
					waiting:{
						autoShow:false,//自动显示等待框，默认为true
					}
				};
				mui.openWindow("login.html","login.html",options);
				
			},1000)
		}	
	});
	
	
	
	
	
	
	
	
	
		
</script>
</html>









